package java04;
public class Exception02 {
    public static int divide(int x,int y)throws Exception{//使用throws关键字声明抛出异常
        int result = x / y;
        return result;
    }
    public static void main(String[] args){
        try{
            int result = divide(7,0);
            System.out.println(result);
        }catch(Exception e){
            System.out.println("捕获的异常信息为：" + e.getMessage());
        }
    }
}
